/*******************************************************************************
 * @brief: 编译器配置
 * @Author:   aple
 * @Date: 2022-10-27 13:54:18
 * @LastEditors: aple
 * @LastEditTime: 2022-10-28 08:03:04
 * @Verision: 1.0.0.0
 ******************************************************************************/

#ifndef __CC_CFG_H__
#define __CC_CFG_H__

#ifdef __cplusplus
extern "C"
{
#endif
	
/*
 * win32
 */
#if   defined ( _WIN32 )
#define OBJ_SECTION(x)
#define OBJ_UNUSED
#define OBJ_USED
#define PRAGMA(x)
#define OBJ_ALIGN(n)
#define OBJ_WEAK
#define OBJ_INLINE
	
	
/*
 * Arm Compiler 4/5
 */
#elif   defined ( __CC_ARM )
#define OBJ_SECTION(x) __attribute__((section(x)))
#define OBJ_UNUSED __attribute__((unused))
#define OBJ_USED __attribute__((used))
#define OBJ_ALIGN(n) __attribute__((aligned(n)))
#define OBJ_WEAK __attribute__((weak))
#define OBJ_INLINE static __inline

/*
 * Arm Compiler 6 (armclang)
 */
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#define OBJ_SECTION(x) __attribute__((section(x)))
#define OBJ_UNUSED __attribute__((unused))
#define OBJ_USED __attribute__((used))
#define OBJ_ALIGN(n) __attribute__((aligned(n)))
#define OBJ_WEAK __attribute__((weak))
#define OBJ_INLINE static __inline
	
/*
 * GNU Compiler
 */
#elif defined ( __GNUC__ )
#ifdef RT_USING_NEWLIB
#include <stdarg.h>
#else
/* the version of GNU GCC must be greater than 4.x */
// typedef __builtin_va_list __gnuc_va_list;
// typedef __gnuc_va_list va_list;
// #define va_start(v, l) __builtin_va_start(v, l)
// #define va_end(v) __builtin_va_end(v)
// #define va_arg(v, l) __builtin_va_arg(v, l)
#endif

#define OBJ_SECTION(x) __attribute__((section(x)))
#define OBJ_UNUSED __attribute__((unused))
#define OBJ_USED __attribute__((used))
#define OBJ_ALIGN(n) __attribute__((aligned(n)))
#define OBJ_WEAK __attribute__((weak))
#define OBJ_INLINE static __inline
	
/*
 * IAR Compiler
 */
#elif defined ( __ICCARM__ )
#include <stdarg.h>
#define OBJ_SECTION(x) @x
#define OBJ_UNUSED
#define OBJ_USED __root
#define PRAGMA(x) _Pragma(#x)
#define OBJ_ALIGN(n) PRAGMA(data_alignment = n)
#define OBJ_WEAK __weak
#define OBJ_INLINE static inline
	
/*
 * TI Arm Compiler
 */
#elif defined ( __TI_ARM__ )


#else
  #error Unknown compiler.
#endif

	/*******************************************************************************
	 *                                   EOF
	 *******************************************************************************/

#ifdef __cplusplus
}
#endif

#endif
